<template>
  <title-card :title="title" :titleVisible="titleVisible">
    <slot name="header" slot="header"></slot>
    <common-chart slot="content" v-if="type !== 'table'" :type="type" :dataset="dataset"
                  @chartClick="$emit('chartClick',$event)"></common-chart>
    <slot v-else></slot>
  </title-card>
</template>

<script>
import CommonChart from './CommonChart'

export default {
  name: 'TitleChart',
  props: {
    titleVisible: {
      type: Boolean,
      default: true
    },
    title: {
      type: String,
      default: '标题'
    },
    type: {
      type: String,
      default: 'chart-line'
    },
    dataset: {
      type: Object,
      default: () => ({
        dimensions: [],
        source: [],
        option: {}// 图表自定义配置项
      })
    }
  },
  components: {
    CommonChart
  },
  computed: {}
}
</script>
